import tkinter as tk


# 编写图片资源类
class ImageResource:
    # 飞机的图片 - 初始化为空 - 如果永远用不着这个飞机，就不要初始化
    PlaneImg = None
    def getPlaneImg(self):
        # 如果还没有读取飞机的图片
        if self.PlaneImg == None:
            # 读取图片
            self.PlaneImg = tk.PhotoImage(file='./static/飞机.png')
        # 直接返回飞机图片
        return self.PlaneImg
        
    # 子弹的图片
    BulletImg = None
    def getBulletImg(self):
        if self.BulletImg == None:
            self.BulletImg = tk.PhotoImage(file='./static/子弹.png')
        return self.BulletImg
    
    # 敌机的图片
    EnemyImg = None
    def getEnemyImg(self):
        if self.EnemyImg == None:
            self.EnemyImg = tk.PhotoImage(file='./static/敌机.png')
        return self.EnemyImg
    
    # 爆炸的图片
    BoomImg1 = None
    BoomImg2 = None
    BoomImg3 = None
    def getBoomImg1(self):
        if self.BoomImg1 == None:
            self.BoomImg1 = tk.PhotoImage(file='./static/爆炸1.png')
        return self.BoomImg1
    def getBoomImg2(self):
        if self.BoomImg2 == None:
            self.BoomImg2 = tk.PhotoImage(file='./static/爆炸2.png')
        return self.BoomImg2
    def getBoomImg3(self):
        if self.BoomImg3 == None:
            self.BoomImg3 = tk.PhotoImage(file='./static/爆炸3.png')
        return self.BoomImg3

    
# 获取图片资源
imageResource = ImageResource()